<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./lib/vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- keyup监听元素 -->
        <input type="text" v-model="firstname" @keyup="change">+
        <input type="text" v-model="lastname" @keyup="change">=
        <input type="text" v-model="fullname">
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                firstname: "",
                lastname: "",
                fullname: ""
            },
            methods: {
                change(){
                    this.fullname = this.firstname + "-" + this.lastname;
                }
            }
        });
    </script>
</body>

</html>